package com.itheima.utils;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.io.Serializable;

/**
 * @author yan.zhou
 * @date 2022/1/22
 */
@Data
@NoArgsConstructor
@AllArgsConstructor
public class ResultData implements Serializable {
    private Integer code;
    private String message;
    private Object data;

    public static ResultData ok(String errmsg, Object data){
        return new ResultData(200, errmsg, data);
    }

    public static ResultData error(String errmsg){
        return new ResultData(404, errmsg, null);
    }

    public static ResultData notLogin(){
        return new ResultData(9998, "未登录，不允许操作！", null);
    }
}
